package com.friendfeed.api;

import org.json.JSONException;
import org.json.JSONObject;

import java.text.ParseException;
import java.util.Date;

public class Like {
    private Date date;
    private User user;

    public Like() {
    }

    public Like(JSONObject jsonObject) throws JSONException, ParseException {
        if (jsonObject.has("date") && !jsonObject.isNull("date")) {
            date = FriendFeedUtils.parseDate(jsonObject.getString("date"));
        }
        user = new User(jsonObject.getJSONObject("user"));
    }

    public Date getDate() {
        return date;
    }

    public User getUser() {
        return user;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public String toString() {
        return "Like{" +
                "date=" + date +
                ", user=" + user +
                '}';
    }
}
